home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
setcurs.zip
/
BINTEST.ASM
< prev
next >
Wrap
Assembly Source File
|
1991-01-04
|
6KB
|
278 lines
;*
;* Bintest.Asm - template for creating dbV bins
;* Using QuickAsm
;*
;* This template has 2 uses:
;*
;* 1. With Make Option set to debug
;* it creates a standalone .COM file, that is easily debugged
;*
;* 2. With Make Option set to Release
;* it creates an .OBJ file that can then be linked & exe2bin'ed
;* Note: QC cannot generate the BIN file you must:
;* LINK BINTEST;
;* EXE2BIN BINTEST
;* RENAME BINTEST.BIN TO <whatever>
NumParms = 2 ; specify the number of parameters
; to be passed to BIN
; place test parameters in P1, P2, etc.
.Model Tiny,Pascal ; Saves space
.Code
;* .COM code only
IFNDEF NDEBUG ; This code is compiled for the QC2.5 Enviornment
.StartUp
; Emulate dBASE parameter passing convention
Mov Cx,NumParms ; Number of parameters
Mov PB1,Cs ; Fixup for parameters
Mov Pb2,Cs ; .
Mov Pb3,Cs ; .
Mov Pb4,Cs ; .
Mov Pb5,Cs ; .
Mov Pb6,Cs ; .
Mov Pb7,Cs ; .
Lea Di,PB ; ES is already set (via .Model Tiny)
Call Main ; Call Bin routine
.Exit
ELSE
;* .BIN code only
%Out Build for dBASE IV BIN File
Org 0
Int 03h ; For Debbuging purposes
ENDIF
IFNDEF NDEBUG
;* .COM only
Main Proc
ELSE
;* .BIN only
Main Proc Far
ENDIF
;* Common code
PARAM1 EQU ES:[DI+0]
PARAM2 EQU ES:[DI+4]
PARAM3 EQU ES:[DI+8]
PARAM4 EQU ES:[DI+12]
PARAM5 EQU ES:[DI+16]
PARAM6 EQU ES:[DI+20]
PARAM7 EQU ES:[DI+24]
START:
Push Bp ; Save stack frame
Mov Bp, Sp
; Quit if there not the correct number of parameters.
Cmp Cx, NumParms
Je @F
Jmp Short Done
@@:
Push Ds
Mov Ax, Cs
Mov Ds, Ax ;* Ds addressability <easier to think>
IFNDEF NDEBUG
Call SaveState
Push Es
Push Di
ENDIF
;****************************************************************
;*
;* Actual bin routines go here.
;*
;****************************************************************
; This routine, when LOADed and CALLed from DB4, will turn the
; cursor on and off, as well as toggle from an underline style
; cursor to a block cursor.
; Examples:
; CALL setcurs WITH "F" && turns off the cursor
; CALL setcurs WITH "O","B" && turns on a block cursor
; CALL setcurs WITH "O","U" && turns on a standard cursor
LDS BX, PARAM1 ; DS:BX -> 1'st param
CMP BYTE PTR [BX],'F' ; cursor OFF?
JNE ON ; no, turn cursor on
MOV CX,200Fh ; else turn it off code in CX
JMP SHORT CALLROM ; call the BIOS
ON:
MOV CX, 0011h ; assume block cursor
LDS BX, PARAM2 ; DS:BX -> 2'nd param
CMP BYTE PTR [BX],'B' ; Block cursor?
JE CALLROM ; yes, jump
INT 11h ; find out what kind of equip.
MOV CX,0607h ; assume color scan lines
AND AL,10h ; check tho
JZ CALLROM ; OK? jump
MOV CX,0B0Ch ; whoops, set mono scan lines
CALLROM:
MOV AH,01
INT 10h
;****************************************************************
;*
;* End of BIN
;*
;****************************************************************
;* .COM code only
IFNDEF NDEBUG ; This code is compiled for the QC2.5 Enviornment
; so we can determine if we have in fact done anything
; Simply prints each of the resulting parameters
Mov Ah, 01h ; pause, press a key
Int 21h
Pop Di
Pop Es
Call VerifyState
Mov Cx,NumParms
Xor Bx,Bx
NextParm:
Lds Dx,Es:[Di+Bx]
Mov Si,Dx
@@:
Cmp Byte Ptr [Si],0
Je @F
Inc Si
Jmp Short @B
@@:
Mov Byte Ptr [Si],'$'
Mov Ah,09h
Int 21h
Lea Dx,CrLf
Int 21h
Add Bx,4
Loop NextParm
Endif
;* Common code
Done:
Pop Ds
Pop Bp ; Restore stack frame
Ret
Main Endp
;* .COM code only
IFNDEF NDEBUG
;* Saves lengths of all parameters
SaveState Proc
Push Di
Mov Cx,NumParms
Lea Bx,ParmLen
NextParm:
Lds Dx,Es:[Di]
Mov Si,Dx
@@:
Cmp Byte Ptr [Si],0
Je @F
Inc Si
Jmp Short @B
@@:
Mov Ax,Si
Sub Ax,Dx
Mov Byte Ptr [Bx],Al
Inc Bx
Loop NextParm
Pop Di
Ret
SaveState Endp
VerifyState Proc
Push Di
Mov Cx,NumParms
Lea Bx,ParmLen
NextParm:
Lds Dx,Es:[Di]
Mov Si,Dx
@@:
Cmp Byte Ptr [Si],0
Je @F
Inc Si
Jmp Short @B
@@:
Mov Ax,Si
Sub Ax,Dx
Cmp Byte Ptr [Bx],Al
Je @F
Mov Ah,09h
Lea Dx,Warning
Int 21h
@@:
Inc Bx
Loop NextParm
Pop Di
Ret
Ret
VerifyState Endp
; INSERT TEST PARAMETERS HERE
;****************************
P1 Db 'O',0
P2 Db 'B',0
P3 DB 0
P4 DB 0
P5 DB 0
P6 DB 0
P7 Db 0
;****************************
PB Label Word
DW Offset P1
PB1 Dw ?
Dw Offset P2
Pb2 Dw ?
DW Offset P3
PB3 Dw ?
Dw Offset P4
Pb4 Dw ?
Dw Offset P5
PB5 Dw ?
Dw OffSet P6
PB6 Dw ?
DW OffSet P7
PB7 Dw ?
CrLf Db 13,10,'$'
Warning Db 7,13,10
Db '** WARNING ** Length of passed parameters has changed!'
Db 13,10,'$'
ParmLen Db 7 dup (0) ; Array of parameter lengths
; @ call time
ENDIF
END